/* 游戏整体布局 */
.game-wrapper {
    min-height: 100vh;
    background: #f0f2f5;
    padding: 20px;
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    padding: 20px;
}

/* 游戏头部样式 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.room-info h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #2c3e50;
}

.game-status {
    margin-top: 5px;
    font-size: 0.9rem;
    color: #666;
}

.player-actions {
    display: flex;
    gap: 10px;
}

/* 游戏主区域布局 */
.game-main {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 20px;
    min-height: 700px;
}

/* 侧边栏样式 */
.player-list-sidebar,
.game-info-sidebar {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.player-list-container,
.game-info-container {
    height: 100%;
}

/* 玩家列表样式 */
.player-list-container h4,
.game-info-container h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

#playersList li {
    padding: 10px;
    background: #fff;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* 游戏区域样式 */
.game-play-area {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* 其他玩家区域 */
.other-players {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
}

.player-spot {
    width: 200px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

/* 牌桌中央区域 */
.table-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.landlord-cards-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.landlord-card {
    width: 60px;
    height: 90px;
    background: #e9ecef;
    border-radius: 5px;
    border: 2px solid #dee2e6;
}

.played-cards-area {
    min-height: 120px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.02);
    border-radius: 8px;
    position: relative;
}

/* 出牌动画样式 */
.played-card {
    position: absolute;
    width: 80px;
    height: 120px;
    background: white;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center center;
}

/* 出牌动画关键帧 */
@keyframes playCardAnimation {
    0% {
        transform: translate(var(--start-x), var(--start-y)) rotate(var(--random-rotate));
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--end-x), var(--end-y)) rotate(0deg);
        opacity: 1;
    }
}

/* 出牌堆叠效果 */
.played-card-stack {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.played-card-stack .played-card {
    position: relative;
    margin-left: -30px;
    transition: transform 0.3s ease;
}

.played-card-stack .played-card:hover {
    transform: translateY(-10px);
    z-index: 10;
}

/* 当前玩家区域 */
.current-player-area {
    margin-top: 20px;
}

.my-cards {
    min-height: 150px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.game-controls button {
    padding: 8px 25px;
    border-radius: 20px;
    font-weight: 500;
}

/* 游戏信息区域 */
.game-stats {
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.play-history-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #fff;
    border-radius: 6px;
}

/* 卡牌样式优化 */
.card-item {
    width: 80px;
    height: 120px;
    background: white;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: absolute;
    transition: all 0.2s ease;
}

.card-item.selected {
    transform: translateY(-20px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .game-main {
        grid-template-columns: 200px 1fr 200px;
    }
}

@media (max-width: 992px) {
    .game-main {
        grid-template-columns: 1fr;
    }
    
    .player-list-sidebar,
    .game-info-sidebar {
        display: none;
    }
    
    .other-players {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .player-spot {
        width: 100%;
        max-width: 300px;
    }
}

/* 动画效果 */
@keyframes cardHover {
    0% { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}

.card-item:hover {
    animation: cardHover 0.2s ease forwards;
}

/* 状态样式 */
.player-ready {
    color: #28a745;
}

.player-waiting {
    color: #ffc107;
}

/* 工具类 */
.text-shadow {
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.hover-scale {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* 叫分按钮样式 */
.bidding-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.bid-btn {
    min-width: 80px;
    padding: 8px 15px;
    border-radius: 20px;
}

/* 游戏历史记录样式 */
.history-item {
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
}

.player-name {
    font-weight: 500;
    color: #2c3e50;
    margin-right: 8px;
}

.action-text {
    color: #666;
}

/* 地主牌式优化 */
.landlord-card {
    width: 60px;
    height: 90px;
    background: white;
    border-radius: 5px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.landlord-cards-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* 玩家角色标识 */
.player-role {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    margin-left: 8px;
}

.role-landlord {
    background: #ffd700;
    color: #000;
}

.role-farmer {
    background: #28a745;
    color: #fff;
}

/* 准备按钮样式 */
#readyBtn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#readyBtn:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

#readyBtn:hover:before {
    width: 200%;
    height: 200%;
}

/* 按钮点击动画 */
.btn-clicked {
    transform: scale(0.95);
}

/* 准备按钮状态样式 */
#readyBtn.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #000;
}

#readyBtn.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
}

#readyBtn.btn-secondary {
    cursor: not-allowed;
    opacity: 0.65;
}

/* 添加图标间距 */
#readyBtn i {
    margin-right: 5px;
}

/* 叫分控制区域样式 */
.bidding-controls {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 20px;
}

.current-bid-info {
    margin-bottom: 15px;
    font-size: 1.1em;
    color: #2c3e50;
}

.max-bid {
    font-weight: bold;
    color: #e74c3c;
}

.bid-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.bid-btn {
    min-width: 80px;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.bid-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.bid-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 叫分按钮样式 */
.bid-btn[data-bid="3"] {
    background-color: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

.bid-btn[data-bid="2"] {
    background-color: #f39c12;
    border-color: #f39c12;
    color: white;
}

.bid-btn[data-bid="1"] {
    background-color: #3498db;
    border-color: #3498db;
    color: white;
}

.bid-btn[data-bid="0"] {
    background-color: #95a5a6;
    border-color: #95a5a6;
    color: white;
}

/* 游戏提示弹窗样式 */
.game-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 350px;
    min-width: 250px;
    background: white;
    color: #333;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

.game-alert-error {
    border-left: 4px solid #e74c3c;
}

.game-alert-success {
    border-left: 4px solid #2ecc71;
}

.game-alert-warning {
    border-left: 4px solid #f1c40f;
}

.game-alert-info {
    border-left: 4px solid #3498db;
}

.game-alert-icon {
    font-size: 1.5em;
}

.game-alert-error .game-alert-icon {
    color: #e74c3c;
}

.game-alert-success .game-alert-icon {
    color: #2ecc71;
}

.game-alert-warning .game-alert-icon {
    color: #f1c40f;
}

.game-alert-info .game-alert-icon {
    color: #3498db;
}

.game-alert-content {
    flex: 1;
}

.game-alert-fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

/* 改进的按钮动画 */
.btn-clicked {
    transform: scale(0.95);
    opacity: 0.8;
}

/* 改进的卡牌动画 */
.card-clicked {
    animation: cardClick 0.2s ease-out;
}

@keyframes cardClick {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* 添加加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 改进的卡牌选择效果 */
.card-item.selected {
    transform: translateY(-20px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border: 2px solid #3498db;
}

/* 添加过渡效果 */
.card-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 改进的玩家状态显示 */
.player-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.player-ready {
    background: rgba(46, 204, 113, 0.1);
    color: #27ae60;
}

.player-waiting {
    background: rgba(241, 196, 15, 0.1);
    color: #f39c12;
}

/* 添加横屏媒体查询 */
@media screen and (orientation: landscape) and (max-height: 768px) {
    .game-wrapper {
        padding: 10px;
        min-height: 100vh;
    }
    
    .game-container {
        padding: 10px;
    }
    
    /* 调整游戏头部 */
    .game-header {
        padding: 8px 10px;
        margin-bottom: 10px;
    }
    
    .room-info h2 {
        font-size: 1.2rem;
    }
    
    /* 调整主游戏区域布局 */
    .game-main {
        grid-template-columns: 1fr;
        gap: 10px;
        min-height: auto;
    }
    
    /* 隐藏侧边栏，改用弹出式菜单 */
    .player-list-sidebar,
    .game-info-sidebar {
        display: none;
    }
    
    /* 优化其他玩家区域 */
    .other-players {
        flex-direction: row;
        justify-content: space-between;
        margin-bottom: 10px;
    }
    
    .player-spot {
        width: 120px;
        padding: 8px;
        font-size: 0.9em;
    }
    
    /* 调整牌桌中央区域 */
    .table-center {
        gap: 10px;
    }
    
    .landlord-cards-container {
        margin-bottom: 10px;
    }
    
    .landlord-card {
        width: 40px;
        height: 60px;
    }
    
    /* 调整玩家手牌区域 */
    .my-cards {
        min-height: 100px;
        padding: 10px;
        margin-bottom: 10px;
    }
    
    /* 调整卡牌大小 */
    .card-item {
        width: 50px;
        height: 75px;
        font-size: 0.9em;
    }
    
    .card-item.selected {
        transform: translateY(-10px);
    }
    
    /* 添加弹出式菜单按钮 */
    .menu-toggle {
        display: block;
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 1000;
    }
    
    /* 弹出式菜单样式 */
    .mobile-menu {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 250px;
        height: 100vh;
        background: white;
        box-shadow: -2px 0 5px rgba(0,0,0,0.1);
        z-index: 999;
        padding: 20px;
        overflow-y: auto;
    }
    
    .mobile-menu.active {
        display: block;
    }
    
    /* 调整按钮大小 */
    .game-controls button {
        padding: 6px 15px;
        font-size: 0.9em;
    }
    
    /* 优化出牌区域 */
    .played-cards-area {
        min-height: 80px;
    }
    
    .played-card {
        width: 50px;
        height: 75px;
    }
    
    /* 调整游戏提示弹窗 */
    .game-alert {
        max-width: 250px;
        font-size: 0.9em;
    }
}

/* 移动端玩家列表样式 */
.mobile-player-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}

.mobile-player-item .player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.mobile-player-item .card-count {
    font-size: 0.9em;
    color: #666;
}

.mobile-menu .game-stats {
    margin: 15px 0;
}

.mobile-menu .stat-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.close-menu {
    padding: 5px 10px;
    font-size: 1.2em;
}

.card-inner .red {
    color: red;
}

/* 游戏结算弹窗样式 */
.game-result {
    padding: 20px;
}

.score-list {
    margin-top: 20px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-role {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
}

.score-value {
    font-size: 1.2em;
    font-weight: bold;
}

.score-value.positive {
    color: #28a745;
}

.score-value.negative {
    color: #dc3545;
}

.countdown {
    font-size: 1.1em;
    color: #666;
}

#gameOverModal .modal-content {
    background: #f8f9fa;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#gameOverModal .modal-header {
    border-bottom: 2px solid #eee;
    padding: 1.5rem;
}

#gameOverModal .modal-footer {
    border-top: none;
    justify-content: center;
    padding: 1.5rem;
}